/* GUI CONVERTED from rcctwbb.p (converter v1.76) Tue Aug 20 15:41:40 2002 */
/* rcctwbb.p  - CONTAINER WORKBENCH - SUB PROGRAM                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.15.1.8 $                                                         */
/*V8:ConvertMode=Maintenance                                                  */
/* VERSION 7.5        LAST MODIFIED: 11/14/94           BY: GWM  *J049*       */
/* VERSION 8.5        LAST MODIFIED: 04/16/96           BY: GWM  *J0JC*       */
/* VERSION 8.5        LAST MODIFIED: 04/24/96           BY: GWM  *J0K8*       */
/* VERSION 8.5        LAST MODIFIED: 07/28/96           BY: taf  *J12M*       */
/* VERSION 8.5        LAST MODIFIED: 07/31/96           BY: taf  *J134*       */
/* REVISION: 8.6      LAST MODIFIED: 08/03/96   BY: *K003* Vinay Nayak-Sujir  */
/* REVISION: 8.6      LAST MODIFIED: 10/31/96   BY: *K003* Steve Goeke        */
/* REVISION: 8.5      LAST MODIFIED: 02/12/97   BY: *J1HV* B. Gates           */
/* REVISION: 8.6      LAST MODIFIED: 06/10/97   BY: *K0DY* Taek-Soo Chang     */
/* REVISION: 8.6      LAST MODIFIED: 06/18/97   BY: *K0F5* Taek-Soo Chang     */
/* REVISION: 8.6      LAST MODIFIED: 11/18/97   BY: *J22Y* Ajit Deodhar       */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 07/22/98   BY: *J2M7* Niranjan R.        */
/* REVISION: 8.6E     LAST MODIFIED: 01/12/99   BY: *J37V* Seema Varma        */
/* REVISION: 8.6E     LAST MODIFIED: 01/11/99   BY: *J389* Surekha Joshi      */
/* REVISION: 8.6E     LAST MODIFIED: 08/18/99   BY: *K223* Santosh Rao        */
/* REVISION: 8.6E     LAST MODIFIED: 12/02/99   BY: *L0M0* Manish  K.         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Revision: 1.15.1.5     BY: Jean Miller    DATE: 03/22/01 ECO: *P008*       */
/* Revision: 1.15.1.6     BY: Dan Herman     DATE: 07/09/01 ECO: *P007*       */
/* Revision: 1.15.1.7     BY: Chris Russell  DATE: 08/12/02 ECO: *P0DX*       */
/* $Revision: 1.15.1.8 $  BY: Samir Bavkar    DATE: 08/15/02 ECO: *P09K*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcctwbb_p_1 "Comments"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

{rcinvtbl.i new}

/* INPUT PARAMETERS */
define input parameter ship_from as character.
define input parameter tmp_prefix as character.
define input parameter abs_recid as recid.

/* LOCAL VARIABLES */
define variable save_frame_line as integer no-undo.
define variable i as integer no-undo.
define variable first_column as character format "x(5)" no-undo.
define variable transtype as character initial "ISS-UNP" no-undo.
define variable nullstr as character no-undo.
define variable undotran like mfc_logical no-undo.
define variable del-yn like mfc_logical no-undo.

define variable cmmts like mfc_logical label {&rcctwbb_p_1} no-undo.
define variable delete_recid as recid no-undo.
define variable sel_var_add as integer format "9" no-undo.
define variable sel_var_del as integer format "9" no-undo.
define variable error_lot as logical no-undo.
define variable error_part as logical no-undo.
define variable valid_entry as logical no-undo.
define variable refresh as logical no-undo.
define variable cont_id as character format "X(9)" no-undo.
define variable return_code as integer no-undo.
define variable sort_recs as logical no-undo.
define variable create_recs as logical no-undo.
define variable gwt_um as character no-undo.
define variable nwt_old like abs_nwt no-undo.
define variable shipgrp like sgad_grp no-undo.
define variable parent_abs_recid as recid no-undo.
define variable par_absid like abs_id no-undo.
define variable par_shipfrom like abs_shipfrom no-undo.
define variable qty_old as decimal no-undo.
define variable vol_old as decimal no-undo.
define variable ok_to_recalc_wt_vol like mfc_logical no-undo.
define variable ch_nwt like abs_nwt no-undo.

define variable l_twt_old      like abs_nwt no-undo.
define variable l_abs_tare_wt  like abs_nwt no-undo.
define variable l_twt_um       as character no-undo.
define variable l_delproc like mfc_logical no-undo .
define variable vLastField as character no-undo .
define variable vNewOrder like mfc_logical no-undo.
define variable vOldOrder like abs_order no-undo.
define variable vOldLine  like abs_line  no-undo.
define variable use-log-acctg as logical no-undo.
define variable l_FrTermsErr like mfc_logical no-undo.
define variable l_FrTermsOnFirstOrder like so_fr_terms no-undo.


/* OUTPUT VARIABLES */
define new shared variable new_site like si_site.
define new shared variable err_stat as integer.
define new shared variable so_db as character.
define new shared variable cmtindx like cmt_indx.

define variable add_container as logical no-undo.
define variable add_item as logical no-undo.
define variable add_parent_container as logical no-undo.

/* BUFFERS */
define buffer ship_line for abs_mstr.
define buffer abs_parent_buff for abs_mstr.

/* CONTAINER WORKBENCH FORMS */
{rcctwbfm.i}

/* VARIABLE DEFINITIONS FOR gpfile.i */
{gpfilev.i}
{cclc.i} /* DETERMINE IF CONTAINER AND LINE CHARGES IS ENABLED*/

/* CHECK IF LOGISTICS ACCOUNTING IS ENABLED */
{gprun.i ""lactrl.p"" "(output use-log-acctg)"}
/*GUI*/ if global-beam-me-up then undo, leave.


/* INITIALIZE CENTRAL DATABASE ALIAS NAME */
assign
   so_db = global_db
   parent_abs_recid = abs_recid.

find ship_line where recid(ship_line) = abs_recid no-lock no-error.

if not available ship_line then
assign
   add_container = true
   add_item = true
   add_parent_container = true
   create_recs = true.
else
   sort_recs = true.

mainloop:
repeat:
/*GUI*/ if global-beam-me-up then undo, leave.


   /* CREATE NEW RECORDS */
   if create_recs then do:

      {gprun.i ""rcctwbc.p""
         "(input ship_from,
           input add_container,
           input add_item,
           input add_parent_container,
           input tmp_prefix,
           input false,
           input '',
           input-output abs_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


      /* RESORT AND REPAINT THE SCREEN WITH NEW RECORDS */
      assign
         sort_recs = true
         create_recs = false.

   end. /* IF CREATE_RECS */

   scope_trans:
   do transaction:
/*GUI*/ if global-beam-me-up then undo, leave.


      editloop:
      repeat with frame k:
/*GUI*/ if global-beam-me-up then undo, leave.


         /* SORT THE RECORDS AND EXCLUSIVE-LOCK THEM ALL */
         if sort_recs then do:

            {gprun.i ""rcctwba.p""
               "(input abs_recid,
                 input tmp_prefix,
                 output return_code)"}
/*GUI*/ if global-beam-me-up then undo, leave.


            /* HANDLE ERRORS */
            if return_code > 0 then
               undo editloop, leave mainloop.

            assign
               sort_recs = false
               abs_recid = ?
               refresh = true.
         end.

         /* REPAINT THE SCREEN */
         if refresh then do:

            status input stline[13].
            clear frame k all no-pause.

            /* FIND SAVED RECORD */
            if abs_recid <> ? then
            find ship_line where recid(ship_line) = abs_recid
            no-lock no-error.

            /* NO SAVED RECORD OR SAVED RECORD NOT FOUND */
            if abs_recid = ? or not available ship_line
            then do:

               find first ship_line
               where ship_line.abs_shipfrom = ship_from
                 and ship_line.abs_shipto begins tmp_prefix
               no-lock no-error.

               /* NO MORE RECORDS AVAILABLE SO LEAVE EDITING */
               if not available ship_line then
                  leave mainloop.

               assign
                  save_frame_line = 1
                  abs_recid = ?.

            end.

            /* BACK OFF RECORDS SO THAT THE RECORD WILL BE DISPLAYED */
            /* IN THE SAME FRAME LINE AS BEFORE */
            i = save_frame_line.

            do while i > 1:

               find prev ship_line
                   where ship_line.abs_shipfrom = ship_from
                     and ship_line.abs_shipto begins tmp_prefix
               no-lock no-error.

               i = i - 1.

            end.

            /* REFRESH THE FRAME */
            i = 0.

            do while i < 7:

               if available ship_line then do:

                  display
                     fill(".",minimum(4,integer(ship_line.abs__qad06)))
                     + ship_line.abs__qad06
                       @ first_column
                     substring(ship_line.abs_id,2)
                        when (ship_line.abs_id begins "C"
                              or ship_line.abs_id begins "S")
                        @ cont_id
                     ship_line.abs_item
                     ship_line.abs_qty
                     ship_line.abs__qad02
                  with frame k.

                  find next ship_line
                      where ship_line.abs_shipfrom = ship_from
                        and ship_line.abs_shipto begins tmp_prefix
                  no-lock no-error.

               end.

               i = i + 1.
               if i < 7 then down 1 with frame k.

            end. /* DO WHILE I < 8 */

            /* FIND THE SAVED RECORD */
            if abs_recid <> ? then
               find ship_line where recid(ship_line) = abs_recid
               exclusive-lock no-error.

            /* FIND THE FIRST RECORD */
            else
               find first ship_line
                    where ship_line.abs_shipfrom = ship_from
                      and ship_line.abs_shipto begins tmp_prefix
               exclusive-lock no-error.

            /* MOVE UP TO THE SELECTED RECORD IN THE FRAME */
            up frame-line(k) - save_frame_line.

            refresh = false.

         end. /* IF REFRESH */

         /* RESTORE FIRST_COLUMN */
         color display normal first_column with frame k.

         find pt_mstr where pt_part = ship_line.abs_item
         no-lock no-error.

         display
            ship_line.abs_item
            ship_line.abs_qty
               when (available ship_line and abs_id begins("I"))
            ship_line.abs__qad02
               when (available ship_line and abs_id begins("I"))
         with frame k.

         /* Unpack the abs__qad10 field */
         {absupack.i  "ship_line" 26 22 "l_abs_tare_wt" }

         /* DISPLAY OTHER INFO FOR THE RECORD IN THE LOWER FRAME */
         display
            ship_line.abs_order
            ship_line.abs_line
            substring(ship_line.abs_id,2)
               when (ship_line.abs_id begins "c")
               @ cont_id
            ""
               when (not ship_line.abs_id begins "c")
               @ cont_id
            ship_line.abs_item
            ship_line.abs_qty
            ship_line.abs__qad02
            ship_line.abs_nwt
            ship_line.abs_wt_um
            ship_line.abs_gwt
            ship_line.abs_wt_um @ gwt_um
            ship_line.abs_vol
            ship_line.abs_vol_um
            ship_line.abs_site
            ship_line.abs_loc
            l_abs_tare_wt
            ship_line.abs_wt_um @ l_twt_um
            ship_line.abs_lot
            ship_line.abs_ref
            ship_line.abs__qad04
            pt_desc1 when(available pt_mstr)
            cmmts
         with frame sample.

         /* HANDLE THE UPPER FRAME INTERFACE ONLY IN NON-BATCH MODE */
         if not batchrun then do:

            /* ENABLE UPPER FRAME FOR INPUT */
            set
               first_column
            with frame k editing:

               readkey.

               if lastkey = keycode("F9")
               or keyfunction(lastkey) = "CURSOR-UP"
               or lastkey = keycode("F10")
               or keyfunction(lastkey) = "CURSOR-DOWN"
               or lastkey = keycode("F5")
               or lastkey = keycode("CTRL-D")
               or lastkey = keycode("F1")
               or lastkey = keycode("CTRL-X")
               or lastkey = keycode("PF1")
               or lastkey = keycode("F3")
               or lastkey = keycode("CTRL-T")
               or lastkey = keycode("PF3")
               or keyfunction(lastkey) = "GO"
               or keyfunction(lastkey) = "END-ERROR"
               or lastkey = keycode("F4")
               or lastkey = keycode("RETURN")
               or lastkey = keycode("CTRL-E") then
                  leave.

            end. /* EDITING */

            /* HANDLE THE END-ERROR KEY */
            if lastkey = keycode("F4")
            or keyfunction(lastkey) = "END-ERROR" then
               leave editloop.

            /* HANDLE CURSOR MOVEMENT UP */
            if (lastkey = keycode("F9")
            or keyfunction(lastkey) = "CURSOR-UP")
            then do:

               /* MOVE UP ONE LINE IN SCROLLING WINDOW */
               {rcctwbd.i
                  &direction = "prev"
                  &move = "up"
                  &frame = "k"
                  &field1 = "ship_line.abs_qty"
                  &field2 = "ship_line.abs__qad02"
                  &firstlast = "first"}
            end.

            /* HANDLE CURSOR MOVEMENT DOWN */
            if (lastkey = keycode("F10")
            or keyfunction(lastkey) = "CURSOR-DOWN")
            then do:

               /* MOVE DOWN ONE LINE IN SCROLLING WINDOW */
               {rcctwbd.i
                  &direction = "next"
                  &move = "down"
                  &frame = "k"
                  &field1 = "ship_line.abs_qty"
                  &field2 = "ship_line.abs__qad02"
                  &firstlast = "last"}
               if can-find(first absl_det where absl_abs_id = ship_line.abs_id
                  and absl_abs_shipfrom = ship_line.abs_shipfrom)
               then do:
                  {pxmsg.i &MSGNUM=4457 &ERRORLEVEL=1}
                  /*ADDITIONAL LINE CHARGES EXIST FOR ...*/
               end.

            end.

            /* HANDLE GO KEY */
            if (lastkey = keycode("F1")
               or lastkey = keycode("PF1")
               or lastkey = keycode("CTRL-X")
               or lastkey = keycode("RETURN")
               or keyfunction(lastkey) = "GO")
            then

            set_data:
            do on endkey undo set_data, leave set_data
               on error  undo set_data, retry set_data:
/*GUI*/ if global-beam-me-up then undo, leave.


               /* Check Site Security */
               {gprun.i ""gpsiver.p""
                  "(input ship_line.abs_site,
                    input ?,
                    output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.

               if return_int = 0 then do:
                  /* USER DOES NOT HAVE ACCESS TO THIS SITE */
                  {pxmsg.i &MSGNUM=725 &ERRORLEVEL=3}
                  undo, retry.
               end.

               /* SAVE NET WEIGHT FOR LATER COMPARISON */
               assign
                  vOldOrder = ship_line.abs_order
                  vOldLine = ship_line.abs_line
                  l_twt_old = l_abs_tare_wt
                  nwt_old = ship_line.abs_nwt
                  vol_old = ship_line.abs_vol
                  qty_old = ship_line.abs_qty.

               /* MAINTAIN LOWER FRAME DATA */
               set
                  ship_line.abs_item
                  ship_line.abs_qty
                     when (substring(abs_id,1,1) = "I")
                  l_abs_tare_wt
                     when (substring(abs_id,1,1) = "C")
                  ship_line.abs_nwt
                     when (substring(abs_id,1,1) = "I")
                  ship_line.abs_order
                  ship_line.abs_vol
                  ship_line.abs__qad04
                  ship_line.abs_site
                  ship_line.abs_loc
                  ship_line.abs_lot
                  ship_line.abs_ref
                  ship_line.abs__qad04
                  ship_line.abs_line
                  cmmts
                     when (not(ship_line.abs_id begins "C"))
               with frame sample
               editing:
                  if frame-field <> "" then vLastField = frame-field.
                  readkey.
                  apply lastkey.

                  if (go-pending or
                     (vLastField <> frame-field))  and
                     (using_container_charges      or
                      using_line_charges) then do:
                     run UpdateUserFields
                            (input yes,
                             input vLastField,
                             input ship_line.abs_id,
                             input ship_line.abs_shipfrom).
                  end. /* IF GO-PENDING last-field <> frame-field */
               end. /* EDITING*/

               {abspack.i "ship_line" 26 22 "l_abs_tare_wt" }

               /* IF NEW ITEM ENTERED THEN VALIDATE THE ITEM FIRST */
               if frame sample ship_line.abs_item entered
                  or error_part
               then do:

                  assign
                     new_site = ship_from
                     global_part = ship_line.abs_item
                     error_part = true
                     undotran = true.

                  /* VALIDATE PART EXISTS AT SITE */
                  {gprun.i ""gpptsi01.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


                  if err_stat = 1 then do:
                     /* Item does not exist at this site */
                     {pxmsg.i &MSGNUM=715 &ERRORLEVEL=3}
                     next-prompt abs_item.
                     undo set_data, retry set_data.
                  end.

                  if err_stat = 2 then do:
                     /* Item not found */
                     {pxmsg.i &MSGNUM=16 &ERRORLEVEL=3}
                     next-prompt abs_item.
                     undo set_data, retry set_data.
                  end.

                  error_part = false.

               end.

               /* VALIDATE LOT / PART */
               {gprun.i ""rcctmtb.p""
                  "(input transtype,
                    input ship_from,
                    input ship_line.abs_site,
                    input ship_line.abs_loc,
                    input ship_line.abs_item,
                    input ship_line.abs_lot,
                    input ship_line.abs_ref,
                    input ship_line.abs_qty,
                    input ship_line.abs__qad02,
                    input decimal(ship_line.abs__qad03),
                    output undotran)"}
/*GUI*/ if global-beam-me-up then undo, leave.


               if undotran then undo set_data, retry set_data.

               if ship_line.abs_site <> ship_from then do:

                  {gprun.i ""gpgetgrp.p""
                     "(input ship_line.abs_site,
                       input ship_from,
                       output shipgrp)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                  if shipgrp <> ? then do:

                     find sg_mstr where sg_grp = shipgrp
                     no-lock no-error.

                     if available sg_mstr
                        and sg_auto_tr = no
                     then do:
                        /* AUTOMATIC TRANSFER FROM SITE # TO SITE # PROHIBITED */
                         {pxmsg.i &MSGNUM=5845 &ERRORLEVEL=3
                                  &MSGARG1=ship_line.abs_site
                                  &MSGARG2=ship_from}
                        next-prompt ship_line.abs_site with frame sample.
                        undo set_data, retry set_data.
                     end.

                  end. /* if shipgrp <> ? */

               end. /* if ship_line.abs_site <> ship_from  */

               /* FOR VALID ITEMS ONLY,                             */
               /* IF THE USER ENTERED A NEW QTY AND DIDN'T CHANGE   */
               /* EITHER VOLUME OR WEIGHT, ASK IF VOLUME AND WEIGHT */
               /* SHOULD BE RECALCULATED.                           */
               find pt_mstr where pt_part = ship_line.abs_item
               no-lock no-error.

               /* NET WT AND QTY ARE CHANGED TOGETHER FOR ITEM     */
               /* OR TARE WT AND QTY FOR CONTAINER                 */

               /* SINCE ONLY ITEM LEVEL QUANTITY CAN BE EDITED,    */
               /* THE CODE RELATED TO CHANGING TARE WT AND QTY AT  */
               /* THE CONTAINER LEVEL IS NOT NECESSARY             */

               if available pt_mstr
                  and ship_line.abs_nwt <> nwt_old
                  and ship_line.abs_qty <> qty_old
                  and ship_line.abs_vol = vol_old
               then do:

                  assign
                     ch_nwt =  (ship_line.abs_nwt - nwt_old)
                     ship_line.abs_nwt = nwt_old
                     l_abs_tare_wt = if qty_old <> 0 then
                                        (l_abs_tare_wt / qty_old) *
                                        ship_line.abs_qty
                                     else
                                        l_abs_tare_wt * ship_line.abs_qty

                  {abspack.i "ship_line" 26 22 "l_abs_tare_wt" }

                  /* Change shipper detail net wt and roll up thru parents */
                  {gprun.i ""icshnwt.p""
                     "(input recid(ship_line),
                       input ch_nwt,
                       input yes,
                       input ship_line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                  /* Change shipper detail net wt and roll up thru parents */
                  {gprun.i ""icshnwt.p""
                     "(input recid(ship_line),
                       input l_abs_tare_wt - l_twt_old,
                       input no,
                       input ship_line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                  end. /* IF ABS_NWT <> NWT_OLD AND QTY_OLD <> ABS_QTY */

               if available pt_mstr then do:

                  if ship_line.abs_qty <> qty_old
                     and ship_line.abs_vol = vol_old
                     and ship_line.abs_nwt = nwt_old
                  then do:

                     ok_to_recalc_wt_vol = true.
                     /*Quantity changed.  Recalculate weight and volume?*/
                     {pxmsg.i &MSGNUM=1480 &ERRORLEVEL=1
                              &CONFIRM=ok_to_recalc_wt_vol
                              &CONFIRM-TYPE='LOGICAL'}

                     if ok_to_recalc_wt_vol then do:

                        if qty_old <> 0 then
                           assign
                              ch_nwt = (ship_line.abs_nwt / qty_old )
                                       * ship_line.abs_qty - nwt_old
                              ship_line.abs_nwt  = nwt_old
                              l_abs_tare_wt = (l_abs_tare_wt / qty_old ) *
                                                 ship_line.abs_qty.
                        else
                           assign
                              ch_nwt = maximum(pt_net_wt * ship_line.abs_qty,0)
                              ship_line.abs_nwt    = nwt_old
                              l_abs_tare_wt        =
                                 maximum((pt_ship_wt * ship_line.abs_qty ) -
                                         (pt_net_wt * ship_line.abs_qty ),0)
                              ship_line.abs_vol_um = pt_size_um
                              ship_line.abs_wt_um  = pt_net_wt_um.

                        assign
                           ship_line.abs_vol = pt_size   * ship_line.abs_qty.

                        {abspack.i  "ship_line" 26 22 "l_abs_tare_wt" }

                        {gprun.i ""icshnwt.p""
                           "(input recid(ship_line),
                             input ch_nwt,
                             input yes,
                             input ship_line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                        {gprun.i ""icshnwt.p""
                           "(input recid(ship_line),
                             input ( - ch_nwt),
                             input no,
                             input ship_Line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                        if qty_old <> 0 then
                           ch_nwt = (ship_line.abs_gwt / qty_old )
                                     * ship_line.abs_qty
                                     - (ship_line.abs_gwt).
                        else do:
                           ch_nwt = maximum(pt_ship_wt * ship_line.abs_qty,0).

                           /* ASSIGN NET WT IF ITEM SHIP WT */
                           /* IS ZERO IN PART MASTER */
                           if pt_ship_wt = 0 and pt_net_wt <> 0 then
                              ch_nwt =
                                 maximum(pt_net_wt * ship_line.abs_qty,0).
                        end. /* IF QTY_OLD = 0 */

                        {gprun.i ""icshnwt.p""
                           "(input recid(ship_line),
                             input ch_nwt,
                             input no,
                             input ship_Line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                        display
                           ship_line.abs_nwt
                           ship_line.abs_vol
                        with frame sample.

                     end. /* if ok_to_recalc_wt_vol */

                  end. /* if quantity changed */

               end. /* if available pt_mstr */

               if (using_container_charges      or
                    using_line_charges) then do:
                  run UpdateUserFields
                        (input no,
                         input "",
                         input ship_line.abs_id,
                         input ship_line.abs_shipfrom).

               end. /* IF USING_CONTAINER*/
               if ship_line.abs_order <> "" or
                  ship_line.abs_line  <> "" then do:
                  for first so_mstr where so_nbr = ship_line.abs_order
                  no-lock: end.
                  if not available so_mstr then do:
                     {pxmsg.i &MSGNUM=609 &ERRORLEVEL=3}
                      /*SALES ORDER DOES NOT EXIST*/
                     next-prompt ship_line.abs_order with frame sample.
                     undo set_data, retry set_data.
                  end.
                  else do:
                     for first sod_det no-lock where
                        sod_nbr = so_nbr  and
                        sod_line = integer(ship_line.abs_line):
                     end.
                     if not available sod_det then do:
                        {pxmsg.i &MSGNUM=764 &ERRORLEVEL=3}
                         /* SALES ORD LINE DOESN'T EXIST */
                        next-prompt ship_line.abs_line with frame sample.
                        undo set_data, retry set_data.
                     end.
                     if sod_site <> ship_from then do:
                        {pxmsg.i &MSGNUM=8228
                                 &ERRORLEVEL=3
                                 &MSGARG1=sod_site}
                        /* INVALID ORDER SHIP-FROM SITE */
                        next-prompt ship_line.abs_order with frame sample.
                        undo set_data, retry set_data.
                     end.
                     if sod_part <> ship_line.abs_item and
                        not (ship_line.abs_id begins "c") then do:
                        {pxmsg.i &MSGNUM=8285 &ERRORLEVEL=3}
                        /*MATCHING SO LINE ITEM FOR... */
                        next-prompt ship_line.abs_order with frame sample.
                        undo set_data, retry set_data.
                     end.

                     if use-log-acctg then do:
                        /* VALIDATE SALES ORDER FREIGHT TERMS */
                        run validateSOFrTerms (input ship_line.abs_id,
                                               input ship_line.abs_shipfrom,
                                               input parent_abs_recid,
                                               input so_nbr,
                                               input so_fr_terms,
                                               output l_FrTermsOnFirstOrder,
                                               output l_FrTermsErr).
                        if l_FrTermsErr then do:
                           /* ALL ATTACHED ORDERS MUST HAVE FREIGHT TERMS # */
                           {pxmsg.i &MSGNUM=5056
                                    &ERRORLEVEL=3
                                    &MSGARG1=l_FrTermsOnFirstOrder}
                           next-prompt ship_line.abs_order with frame sample.
                           undo set_data, retry set_data.
                        end. /* IF l_FrTermsErr */
                     end.   /* if use-log-acctg */

                  end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /*ELSE DO*/
               end. /* IF ship_line.abs_order */

               if cmmts then do:

                  assign
                     cmtindx = ship_line.abs_cmtindx.

                  if cmtindx <= 0 then do:

                     /* If comment has not been created, get parameters
                      * for its creating one */
                     run get_abs_parent
                        (input  ship_line.abs_id,
                         input  ship_line.abs_shipfrom,
                         output par_absid,
                         output par_shipfrom).

                     if par_absid <> ? then do:
                        find abs_parent_buff where
                             abs_parent_buff.abs_id = par_absid and
                             abs_parent_buff.abs_shipfrom = par_shipfrom
                        no-lock no-error.
                        if available abs_parent_buff then
                           assign
                              global_ref = abs_parent_buff.abs_format
                              global_lang = abs_parent_buff.abs_lang.
                     end. /* if par_absid <> ? */

                  end. /* if cmtindx <= 0  */

                  {gprun.i ""gpcmmt01.p"" "(input 'abs_mstr')"}
/*GUI*/ if global-beam-me-up then undo, leave.


                  assign
                     ship_line.abs_cmtindx = cmtindx.

               end. /* if cmmts */

               /* Gather additional line item data */
               {gprun.i ""sofsgi.p"" "(recid(ship_line))" }
/*GUI*/ if global-beam-me-up then undo, leave.


               {absupack.i  "ship_line" 26 22 "l_abs_tare_wt" }

               /* MAINTAIN SHIPPER LINE CHARGES */
               if using_line_charges then do:
                  vNewOrder = no.
                  if ship_line.abs_order <> vOldOrder or
                     ship_line.abs_line <> vOldLine then do:
                     {gprunmo.i
                        &module = "ACL"
                        &program = ""rcsochg.p""
                        &param = """(input recid(ship_line),
                                     input vOldOrder,
                                     input vOldLine,
                                     input "''",
                                     input program-name(1))"""}
                     vNewOrder = yes.
                  end.

                  if ship_line.abs_order <> "" and
                     ship_line.abs_id begins "i" then
                     run getLineCharges
                           (input ship_line.abs_shipfrom,
                            input ship_line.abs_id,
                            input ship_line.abs_order,
                            input ship_line.abs_line,
                            input vNewOrder).
               end. /* IF USING_LINECHARGES  */

               /* IF QTY OF THE PARENT CHANGED */

               /* SINCE ONLY ITEM LEVEL QUANTITY CAN BE EDITED,    */
               /* THE CODE RELATED TO CHANGING TARE WT AND QTY AT  */
               /* PARENT LEVEL IS NOT NECESSARY                    */

               /* CHECK FOR WEIGHT CHANGE AND PROPOGATE */
               if ship_line.abs_nwt <> nwt_old and
                  ship_line.abs_qty = qty_old
               then do:

                  assign
                     ch_nwt = ship_line.abs_nwt - nwt_old
                     ship_line.abs_nwt = nwt_old.

                  {gprun.i ""icshnwt.p""
                     "(input recid(ship_line),
                       input ch_nwt,
                       input yes,
                       input ship_line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


               end. /* IF ABS_NWT <> NWT_OLD */

               /* CHECK FOR TARE WEIGHT CHANGE AND PROPOGATE */
               if l_abs_tare_wt <> l_twt_old
                  and ship_line.abs_nwt = nwt_old
                  and ship_line.abs_qty = qty_old
               then do:

                  {gprun.i ""icshnwt.p""
                     "(input recid(ship_line),
                       input l_abs_tare_wt - l_twt_old,
                       input no,
                       input ship_Line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.

               end. /* IF L_ABS_TARE_WT <> L_TWT_OLD */

            end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* set_data */

            cmmts = ship_line.abs_cmtindx > 0.

            /* HANDLE F5 KEY */
            if (lastkey = keycode("F5")
            or lastkey = keycode("CTRL-D")) then
            del_loop:
            do on endkey undo del_loop, leave del_loop
               on error undo del_loop, retry del_loop:
/*GUI*/ if global-beam-me-up then undo, leave.


               save_frame_line = frame-line(k).
               color display input first_column with frame k.

               /* DISPLAY F5 SELECTION FRAME */
               hide frame sample no-pause.
               view frame m1.

               assign
                  sel_var_del = 0
                  valid_entry = false.

               get_selection:
               do on endkey undo get_selection, leave get_selection
                  on error undo get_selection, retry get_selection:
/*GUI*/ if global-beam-me-up then undo, leave.


                  /*PLEASE ENTER SELECTION*/
                  {pxmsg.i &MSGNUM=39 &ERRORLEVEL=1 &CONFIRM=sel_var_del
                           &CONFIRM-TYPE='INTEGER'}

                  if sel_var_del < 1 or sel_var_del > 5 then do:
                     /* Not a valid choice */
                     {pxmsg.i &MSGNUM=13 &ERRORLEVEL=3}
                     undo get_selection, retry get_selection.
                  end.

                  if ship_line.abs_id begins "I" and
                     (sel_var_del <> 1 and sel_var_del <> 2)
                  then do:
                     /* THIS OPTION NOT ALLOWED FOR THIS LINE ITEM */
                     {pxmsg.i &MSGNUM=761 &ERRORLEVEL=3}
                     undo get_selection, retry get_selection.
                  end.

                  /* CHECK FOR ORPHAN ITEM RECORDS */
                  if ship_line.abs_par_id = ""
                     and sel_var_del = 2 or sel_var_del = 4
                  then do:

                     for each abs_mstr
                        where abs_mstr.abs_shipfrom = ship_from
                          and abs_mstr.abs_par_id = ship_line.abs_id
                     no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


                        if abs_mstr.abs_id begins "I" then do:
                           /* CANNOT ORPHAN AN ITEM RECORD */
                           {pxmsg.i &MSGNUM=762 &ERRORLEVEL=3}
                           undo get_selection, retry get_selection.
                        end.

                     end.
/*GUI*/ if global-beam-me-up then undo, leave.


                  end.

                  del-yn = false.

                  /* REMOVE / DELETE RECORD, PLEASE CONFIRM */
                  {pxmsg.i &MSGNUM=11 &ERRORLEVEL=1 &CONFIRM=del-yn
                           &CONFIRM-TYPE='LOGICAL'}

                  if not del-yn then
                     undo get_selection, leave get_selection.

                  valid_entry = true.

               end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* GET SELECTION */

               /* HIDE DELETE FRAME */
               hide frame m1 no-pause.
               view frame sample.

               /* HANDLE DELETE SELECTION */
               if valid_entry then do:

                  delete_recid = recid(ship_line).

                  /* SUBTRACT WEIGHT FROM PARENTS */
                  if sel_var_del <> 1 then do:

                     {absupack.i  "ship_line" 26 22 "l_abs_tare_wt" }

                     if sel_var_del = 2 or sel_var_del = 4 then
                        assign
                           l_twt_old = l_abs_tare_wt * -1
                           nwt_old = ship_line.abs_nwt * -1.
                     else
                        assign
                           l_twt_old = (ship_line.abs_gwt - ship_line.abs_nwt)
                                         * -1
                           nwt_old = ship_line.abs_nwt * -1.

                     if (ship_line.abs_id begins "I" and sel_var_del = 2)
                     or (sel_var_del = 3 or sel_var_del = 5 )
                     then do:
                        {gprun.i ""icshnwt.p""
                           "(input recid(ship_line),
                             input nwt_old,
                             input yes,
                             input ship_line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.

                     end. /* IF SHIP_LINE.ABS_ID BEGINS "I" ...*/

                     {gprun.i ""icshnwt.p""
                        "(input recid(ship_line),
                          input l_twt_old,
                          input no,
                          input ship_line.abs_wt_um)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                  end. /* SEL_VAR_DEL <> 1 */

                  /* REMOVE CONTAINER RECORD OR DELETE CONTAINER RECORD */
                  if (sel_var_del = 2 or sel_var_del = 4)
                     and ship_line.abs_id begins "C"
                  then do:

                     for each abs_mstr
                        where abs_mstr.abs_shipfrom = ship_from
                          and abs_mstr.abs_par_id = ship_line.abs_id
                     exclusive-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


                        /* CHANGE PARENT POINTERS OF CHILD RECORDS */
                        assign
                           abs_mstr.abs_par_id = ship_line.abs_par_id.
                           abs_mstr.abs__qad06 =
                              string(integer(abs_mstr.abs__qad06) - 1,"9").

                        /* ADJUST LEVELS OF CHILD RECORDS */
                        {gprun.i ""rcctwbu3.p""
                           "(input recid(abs_mstr))"}
/*GUI*/ if global-beam-me-up then undo, leave.


                     end.
/*GUI*/ if global-beam-me-up then undo, leave.


                  end. /* IF SEL_VAR_DEL = 2 OR 4 */

                  /* REMOVE STRUCTURE OR DELETE STRUCTURE */
                  if sel_var_del = 3 or sel_var_del = 5 then do:
                     /* SET ALL CHILD RECORD SHIPTO'S TO ""      */
                     /* FOR DELETES WILL ALLOW FIND NEXT TO FIND */
                     /* THE CORRECT RECORD */
                     {gprun.i ""rcctwbu2.p"" "(delete_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.

                  end.

                  assign
                     ship_line.abs_par_id = "".

                  /* REMOVE RECORD - REMOVE STRUCTURE */
                  if sel_var_del = 4 or sel_var_del = 5 then
                     ship_line.abs_shipto = ship_line.abs__qad05.

                  /* CHECK FOR NEXT RECORD */
                  find next ship_line
                      where ship_line.abs_shipfrom = ship_from
                       and ship_line.abs_shipto begins tmp_prefix
                  no-lock no-error.

                  if available ship_line then
                     abs_recid = recid(ship_line).

                  /* IF NO NEXT RECORD THEN FIND PREVIOUS RECORD */
                  else do:

                     find ship_line
                     where recid(ship_line) = delete_recid
                     no-lock no-error.

                     find prev ship_line
                         where ship_line.abs_shipfrom = ship_from
                           and ship_line.abs_shipto begins tmp_prefix
                     no-lock no-error.

                     if available ship_line then do:
                        abs_recid = recid(ship_line).
                        if save_frame_line > 1 then
                           save_frame_line = save_frame_line - 1.
                     end.

                     /* NO RECORDS LEFT SO RESET */
                     else do:
                       assign
                           abs_recid = ?
                           save_frame_line = 1.
                     end.

                  end. /* ELSE DO */

                  /* HANDLE DELETES */
                  if sel_var_del = 2 or sel_var_del = 3 then do:

                     find ship_line
                     where recid(ship_line) = delete_recid
                     exclusive-lock no-error.

                     /* IF DELETE STRUCTURE THEN DELETE ALL CHILDREN */
                     if sel_var_del = 3 then do:

                        /* DELETE ALL CHILD RECORDS */

                        /* ADDED SECOND AND THIRD INPUT PARAMETERS ADJUST */
                        /* ALLOCATION = NO & DELETE = YES.                */
                        /* ADDED INPUT PARAMETER L_DELPROC    */
                        {gprun.i ""rcctwbu1.p""
                           "(input delete_recid,
                             input  no,
                             input  yes,
                             input  l_delproc,
                             output undotran)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                        if undotran then
                           undo del_loop, retry del_loop.

                     end.
                    /*DELETE USER FIELDS and LINE CHARGE RECORDS*/
                     if using_container_charges or using_line_charges then do:
                       {gprunmo.i
                                 &program = "rcabsdd.p"
                                 &module = "ACL"
                                 &param = """(input recid(ship_line))"""}.
                     end.
                     /* DELETE RECORD */
                     delete ship_line.

                  end.

                  /* DELETE ALL RECORDS */
                  if sel_var_del = 1 then do:

                     for each ship_line
                        where ship_line.abs_shipfrom = ship_from
                          and ship_line.abs_shipto begins tmp_prefix
                     exclusive-lock:
/*GUI*/ if global-beam-me-up then undo, leave.

                     /*DELETE USER FIELDS and LINE CHARGE RECORDS*/
                     if using_container_charges or using_line_charges then do:
                       {gprunmo.i
                                 &program = "rcabsdd.p"
                                 &module = "ACL"
                                 &param = """(input recid(ship_line))"""}.
                     end.
                        delete ship_line.
                     end.
/*GUI*/ if global-beam-me-up then undo, leave.


                     assign
                        abs_recid = ?
                        save_frame_line = 1.

                  end.

                  /* REPAINT THE SCREEN WITH NEW RECORDS */
                  refresh = true.

               end. /* IF VALID_ENTRY */

            end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* IF LASTKEY = KEYCODE F5 */

         end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* IF NOT BATCHRUN */

         /* HANDLE F3 KEY */
         /* ALWAYS ENTER ADD MODE WHEN BATCH-RUN */
         if batchrun
            or lastkey = keycode("F3")
            or lastkey = keycode("PF3")
            or lastkey = keycode("CTRL-T")
         then do:

            if ship_line.abs_id begins "I" then do:
               {pxmsg.i &MSGNUM=13 &ERRORLEVEL=3} /* NOT A VALID SELECTION */
               next editloop.
            end.

            color display input first_column with frame k.

            /* DISPLAY F3 ADD OPTIONS FRAME */
            hide frame sample no-pause.
            view frame m.

            assign
               valid_entry = false
               sel_var_add = 1
               save_frame_line = frame-line(k).

            /* GET USER SELECTION */
            get_selection_2:
            do on endkey undo get_selection_2, leave get_selection_2
               on error undo get_selection_2, retry get_selection_2:
/*GUI*/ if global-beam-me-up then undo, leave.


               /* Please enter Selection */
               {pxmsg.i &MSGNUM=39 &ERRORLEVEL=1 &CONFIRM=sel_var_add
                        &CONFIRM-TYPE='INTEGER'}

               if sel_var_add < 1 or sel_var_add > 2 then do:
                  {pxmsg.i &MSGNUM=13 &ERRORLEVEL=3} /* NOT A VALID CHOICE */
                  undo get_selection_2, retry get_selection_2.
               end.

               valid_entry = true.

            end.
/*GUI*/ if global-beam-me-up then undo, leave.


            /* HIDE FRAMES FOR ADD */
            hide frame m no-pause.
            hide frame sample no-pause.
            hide frame k no-pause.

            if batchrun and
               (lastkey = keycode("F4") or
                keyfunction(lastkey) = "END-ERROR" or
                keyfunction(lastkey) = "ENDKEY" or
                keyfunction(lastkey) = "."    or
                lastkey = keycode("CTRL-E"))
            then
               leave editloop.

            /* PROCESS F3 ADD SELECTION */
            if valid_entry then do:

               /*** TRUTH TABLE - SEL_VAR */
               /*               1  2  3   */
               /*                         */
               /* ADD_ITEM      T  F  T   */
               /* ADD_CONTAINER F  T  T   */
               /* ADD_PARENT    F  F  T   */
               /***************************/

               assign
                  abs_recid = recid(ship_line)
                  add_container = true
                  add_item = true
                  add_parent_container = true.

               /* ADD AN ITEM RECORD */
               if sel_var_add = 1 then do:
                  assign
                     add_container = false
                     add_parent_container = false.
               end.

               /* ADD A CONTAINER RECORD */
               if sel_var_add = 2 then do:
                  assign
                     add_item = false
                     add_parent_container = false.
               end.

               create_recs = true.
               next mainloop.

            end. /* IF VALID ENTRY */

         end. /* LASTKEY = KEYCODE F3 */

      end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* editloop */

      /* CLEAN UP RECORDS */
      for each ship_line where
               ship_line.abs_shipfrom = ship_from
           and ship_line.abs_shipto begins tmp_prefix
      exclusive-lock:
         ship_line.abs_shipto = ship_line.abs__qad05.
      end.

      if lastkey = keycode("F4") or
         keyfunction(lastkey) = "END-ERROR" or
         keyfunction(lastkey) = "ENDKEY" or
         ( batchrun and keyfunction(lastkey) = "." ) or
         lastkey = keycode("CTRL-E")
      then
         leave mainloop.

   end. /* scope_trans */

end. /* mainloop */

hide frame k no-pause.
hide frame sample no-pause.

{rcinvcon.i}

PROCEDURE getLineCharges:
   /* PARAMETERS
    * ipShipFrom - Site Address
    * ipAbsID - abs_id from ship_line
    * ipOrder - sales order number
    * ipLine - sales order line
    * ipNewOrder- sales order or line has changed
    */
   define input parameter ipShipFrom like abs_shipfrom no-undo.
   define input parameter ipAbsID like abs_id no-undo.
   define input parameter ipOrder like so_nbr no-undo.
   define input parameter ipLine like abs_line no-undo.
   define input parameter ipNewOrder like mfc_logical no-undo.

   for first so_mstr no-lock where
           so_nbr = ipOrder:
   end.
   if not available so_mstr then leave.

   for first sod_det no-lock where
      sod_nbr = so_nbr and
      sod_line = integer(ipLine):
   end.

   if not available sod_det then leave.

   if ipNewOrder then do:
      {gprunmo.i
         &program = ""sosob1c.p""
         &module = "ACL"
         &param = """(input ipAbsID,
                      input ipShipFrom,
                      input ipOrder,
                      input integer(ipLine))"""}
   end.

   {gprunmo.i
      &program = ""rcabslmt.p""
      &module = "ACL"
      &param = """(input recid(so_mstr),
                   input recid(sod_det),
                   input ipAbsID,
                   input ipShipFrom)"""}

END PROCEDURE.  /*getLineCharges*/

PROCEDURE UpdateUserFields:
   define input parameter ipSpecificField like mfc_logical no-undo.
   define input parameter ipField as character no-undo.
   define input parameter ipAbsID like abs_id no-undo.
   define input parameter ipShipFrom like abs_shipfrom no-undo.

   if can-find(first absd_det where
         absd_abs_id = ipAbsID
     and absd_shipfrom = ipShipFrom
     and absd_abs_fld_name = (if ipSpecificField then
                               ipField else "")
     and absd_fld_prompt = yes)
     then do:

     {gprunmo.i
        &module = "ACL"
        &program = ""rcswbuf.p""
        &param   = """(input ipSpecificField,
                       input ipField,
                       input ipAbsID,
                       input ipShipFrom)"""}
   end. /*IF CAN-FIND*/
END PROCEDURE. /*UpdateUserFields*/


PROCEDURE validateSOFrTerms:
/*--------------------------------------------------------------------
   Purpose:     Get the highest level parent (Shipper record)
                Get the first order attached to this shipper along with
                   the freight terms on this order.
                Compare the terms on this order to that of the input parameter
                  ip_OrderFrTerms and return op_FrTermsErr if they are
                  different.
   Parameters:
   Notes:
----------------------------------------------------------------------*/
   define input parameter ip_AbsId        like   abs_id       no-undo.
   define input parameter ip_ShipFrom     like   abs_shipfrom no-undo.
   define input parameter ip_ParentRecId  as   recid    no-undo.
   define input parameter ip_Order        like so_nbr  no-undo.
   define input parameter ip_OrderFrTerms like so_fr_terms no-undo.

   define output parameter op_FrTermsOnFirstOrder as character  no-undo.
   define output parameter op_FrTermsErr like mfc_logical  no-undo.

   define buffer b1_abs_mstr for abs_mstr.
   define buffer b2_abs_mstr for abs_mstr.

   define variable par_absid like abs_id no-undo.
   define variable par_shipfrom like abs_shipfrom no-undo.
   define variable l_FirstOrder like so_nbr no-undo.

   /* MAKE SURE THAT THE PARENT_ID IS ACTUALLY THE HIGHEST LEVEL PARENT */
   for first b1_abs_mstr where recid(b1_abs_mstr) = ip_ParentRecId
      no-lock:
   end.
   if available b1_abs_mstr and
      b1_abs_mstr.abs_par_id = ""  then
     assign
       par_absid = b1_abs_mstr.abs_id
       par_shipfrom = b1_abs_mstr.abs_shipfrom.
   else do:
     run get_abs_parent (input ip_AbsId,
                         input ip_ShipFrom,
                         output par_absid,
                         output par_shipfrom).
   end. /* ELSE, NOT AVAILABLE b1_abs_mstr */

   if par_absid <> ? then
   do for b2_abs_mstr:
      for first b2_abs_mstr where b2_abs_mstr.abs_id = par_absid and
         b2_abs_mstr.abs_shipfrom = par_shipfrom
         no-lock:
      end.
      if available b2_abs_mstr then do:
         {gprunmo.i  &module = "LA" &program = "lashex01.p"
                     &param  = """(buffer b2_abs_mstr,
                                   output l_FirstOrder,
                                   output op_FrTermsOnFirstOrder)"""}

         /* IF THERE IS AN ORDER ATTACHED TO THE PARENT ABS_MSTR,   */
         /* COMPARE THE FREIGHT TERMS ON THAT ORDER TO THOSE ON THE */
         /* ORDER BEING ATTACHED.                                   */

         if l_FirstOrder <> "" and
            op_FrTermsOnFirstOrder <> ip_OrderFrTerms then
         do:
            op_FrTermsErr = true.
            return.
         end. /* IF l_FirstOrder <> "" AND... */

      end. /* IF AVAILABLE b2_abs_mstr */
   end. /* DO FOR ABS_BUFF6 */

END PROCEDURE. /* validateSOFrTerms */
